/*
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2023-01-10 16:13:41
 * @LastEditors: huangtianyang
 * @LastEditTime: 2023-08-31 11:21:39
 * @FilePath: \cxl-h5\src\apis\register\index.ts
 */
import { request as axios } from '@/axios/index'

/**
 * 验证验证码是否正确 （按需使用该接口）
 * @param phone
 * @param code
 * @returns
 */
export const checkverificationCode = (phone: string, code: string) => {
    return axios({
        method: 'post',
        url: `/api/system/portal/register/checkSms/${phone}/${code}`
    })
}

/**
 * 获取注册时的验证码
 * @param phone
 * @returns
 */
export const getRegisterCode = (phone: string) => {
    return axios({
        method: 'get',
        url: `/api/system/portal/register/sendSms/${phone}`
    })
}

interface dataInterface {
    code: string //短信验证码
    companyAddress: string //公司所在地
    companyBusinessImageKey: string //营业执照 文件上传的key
    companyCode: string //社会信用代码
    companyName: string //企业名称
    password: string //密码
    phone: string //手机号
    introducerCode?: string //推荐人编码
}

/**
 * 注册企业
 * @param data
 * @param code: string //短信验证码
 * @param companyAddress: string //公司所在地
 * @param companyBusinessImageKey: string //营业执照 文件上传的key
 * @param companyCode: string //社会信用代码
 * @param companyName: string //企业名称
 * @param password: string //密码
 * @param phone: string //手机号
 * @returns
 */
export const register = (data: dataInterface) => {
    return axios({
        method: 'post',
        url: '/api/system/portal/register/submit',
        data
    })
}

/**
 * 上传营业执照获取税号
 * @param data
 * @returns
 */
export const businessLicense = (data: FormData) => {
    return axios({
        method: 'post',
        url: '/api/system/portal/register/businessLicense/result/str',
        data
    })
}
